module.exports = function ($scope, $modalInstance, $resource, toaster, obj){

    $scope.obj = obj;

    //审核通过
	$scope.adopt = function() {
        var para = {
            'id' : $scope.obj.id,
            'audit_reason' : $scope.obj.audit_reason,
            'info_state' : '3'
        }
		$resource('/api/as/goc/infodiffusion/updateexamineinfostate', {}, {}).save(para, function(res){
            if (res.errcode === 0) {
                toaster.success({title: '', body: '操作成功'});
                $modalInstance.close();
            } else {
                toaster.error({title: '', body: res.errmsg});
            }
        });
	}
	
	//审核不通过
	$scope.noadopt = function() {
		if(!obj.audit_reason){
			toaster.warning({title: '', body: '请填写审核意见.'});
			return false;
        }
        var para = {
            'id' : $scope.obj.id,
            'audit_reason' : $scope.obj.audit_reason,
            'info_state' : '2'
        }
		$resource('/api/as/goc/infodiffusion/updateexamineinfostate', {}, {}).save(para, function(res){
            if (res.errcode === 0) {
                toaster.success({title: '', body: '操作成功'});
                $modalInstance.close();
            } else {
                toaster.error({title: '', body: res.errmsg});
            }
        });
    }
    
};